/*
    Copyright (C) 2011 Hugo Arregui, FuDePAN

    This file is part of the Biopp Library.

    Biopp is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Biopp is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Biopp.  If not, see <http://www.gnu.org/licenses/>.

    This is a test file.
*/
#include <string>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include "biopp/biopp.h"

using namespace biopp;

TEST(TripletTest, TripletDefaultConstructor)
{
    Triplet t;
    ASSERT_EQ("AAA", t.to_string());
}

TEST(TripletTest, PseudoTripletDefaultConstructor)
{
    PseudoTriplet pst;
    ASSERT_EQ("AAA", pst.to_string());
}

TEST(TripletTest, TripletConstructorCharPtr)
{
    const char* str = "atg";
    Triplet t(str);
    ASSERT_EQ("AUG", t.to_string());
}

TEST(TripletTest, PseudoTripletConstructorCharPtr)
{
    const char* str = "atg";
    PseudoTriplet pst(str);
    ASSERT_EQ("AUG", pst.to_string());
}

TEST(TripletTest, TripletConstructorString)
{
    const std::string str = "atg";
    Triplet t(str);
    ASSERT_EQ("AUG", t.to_string());
}

TEST(TripletTest, PseudoTripletConstructorString)
{
    const std::string str = "atg";
    PseudoTriplet pst(str);
    ASSERT_EQ("AUG", pst.to_string());
}

TEST(TripletTest, TripletCopyConstructor)
{
    Triplet t("atg");
    Triplet t2(t);
    ASSERT_EQ(t, t2);
}

TEST(TripletTest, PseudoTripletCopyConstructor)
{
    PseudoTriplet t("gry");
    PseudoTriplet t2(t);
    ASSERT_EQ(t, t2);
}

TEST(TripletTest, TripletEqualOperator)
{
    Triplet t1("atg");
    Triplet t2("atg");
    ASSERT_EQ(t1, t2);
}

TEST(TripletTest, TripletAsignation)
{
    Triplet t1("atg");
    Triplet t2 = t1;
    ASSERT_EQ(t1, t2);
}

TEST(TripletTest, PseudoTripletAsignation)
{
    PseudoTriplet t1("atg");
    PseudoTriplet t2 = t1;
    ASSERT_EQ(t1, t2);
}

TEST(PseudoTripletTest, PseudoTripletEqualOperator)
{
    PseudoTriplet pst1("atg");
    PseudoTriplet pst2("atg");
    ASSERT_EQ(pst1, pst2);
}

TEST(TripletTest, TripletLessOperator)
{
    Triplet t1("atg");
    Triplet t2("tcg");
    ASSERT_LT(t1, t2);
}

TEST(TripletTest, PseudoTripletLessOperator)
{
    PseudoTriplet pst1("gry");
    PseudoTriplet pst2("hvn");
    ASSERT_LT(pst1, pst2);
}

TEST(TripletTest, TripletArraySubscriptOperator)
{
    Triplet t("aug");
    ASSERT_EQ(t[1], Nucleotide::U);
}

TEST(TripletTest, PseudoTripletArraySubscriptOperator)
{
    PseudoTriplet pst("hvn");
    ASSERT_EQ(pst[2], PseudoNucleotide::N);
}

TEST(TripletTest, TripletContains)
{
    Triplet t("atg");
    ASSERT_TRUE(t.contains(Nucleotide::G));
}

TEST(TripletTest, TripletComplement)
{
    Triplet t("atg");
    t.complement();
    ASSERT_EQ(t, Triplet("TAC"));
}

TEST(PseudoTripletTest, PseudoTripletContains)
{
    PseudoTriplet pst("hvn");
    ASSERT_TRUE(pst.contains(PseudoNucleotide::N));
}
